<?php
/**
 * Mini Feed
 * 
 * @author zli
 */
class MiniFeedModel extends Model {
	protected $tableName = 'mini_feed';
	
	public function feed($contentKeys, $appId) 
	{
		$tempArr = explode ('_',  $appId);
		
		// find widget id
		$widget_id = model('widget')->getWidgetId($tempArr[1], 'feed');
		if (empty($widget_id)) {
			$widget_id = $tempArr[1];
		}
		return $this->add(array(
			'feed_uid' => $_SESSION['mid'],
			'widget_id' => $widget_id,
			'params' => serialize($contentKeys),
			'type' => $appId,
			'utime' => time()
		));
	}
}